//
//  tabBatBtn.m
//  yiYuanDuoBao
//
//  Created by 罗李苏 on 16/11/23.
//  Copyright © 2016年 罗李苏. All rights reserved.
//

#import "tabBatBtn.h"
#import "UIColor+CBJExtention.h"
#import "Masonry.h"

@interface tabBatBtn ()

@end
@implementation tabBatBtn

- (void)setHighlighted:(BOOL)highlighted{}

+ (instancetype)buttonWithImageNmae:(NSString *)imageName text:(NSString *)text{
//    self.imageName = imageName;
//    self.text = text;
//    [self layoutSubview];
    tabBatBtn *btn = [[tabBatBtn alloc] init];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    
    [btn setTitle:text forState:UIControlStateNormal];
    
    btn.titleLabel.font = [UIFont systemFontOfSize:13];

//    [self layoutsubview];
    return btn;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI{

    UIImageView *imageView = [[UIImageView alloc] init];
    [self addSubview:imageView];
    _imView = imageView;
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.top.equalTo(self);
        make.size.mas_equalTo(CGSizeMake(40, 40));
    }];
    
    UILabel *desLabel = [[UILabel alloc] init];
    desLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:desLabel];
    _desLabel = desLabel;
    [desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imView.mas_bottom).offset(8);
//        make.left.equalTo(self).offset(92);
        make.centerX.equalTo(self.imView);
//        make.centerY.mas_equalTo(self.imView);
    }];
}
@end
